package geektime.io.netty;

import io.netty.buffer.*;
import io.netty.util.ReferenceCountUtil;


public class ByteBufTest {
    public static void main(String[] args) {
        ByteBuf byteBuf = Unpooled.buffer(100);
        byteBuf.writeBytes("hello".getBytes());
        byte aByte = byteBuf.getByte(2);
        char c = (char) aByte;
        new PooledByteBufAllocator().directBuffer();
        new PooledByteBufAllocator().heapBuffer();
        new PooledByteBufAllocator().compositeBuffer();
        ByteBuf byteBuf2 = new UnpooledByteBufAllocator(true).heapBuffer();
        ByteBuf byteBuf1 = new UnpooledByteBufAllocator(true).directBuffer();
        CompositeByteBuf byteBufs = new UnpooledByteBufAllocator(true).compositeBuffer();
        ReferenceCountUtil.release(byteBuf);
        byteBuf.release();
    }
}
